# coding: utf-8

from ctypes import *
from os.path import join, abspath, dirname

SF = cdll.LoadLibrary(abspath(join(dirname(__file__), 'shift_finder.so')))

class DPResultExt(Structure):
    _fields_ = [
        ("reward",  c_float),
        ("right_x", c_int),
        ("right_y", c_int),
        ("left_x",  c_int),
        ("sh_num",  c_int),
        ("sh1",     c_int),
    ]

def create_dp_mx(options, base_seq, seq, local=True):
    SF.create_dp_mx_c.restype = DPResultExt
    return SF.create_dp_mx_c(
        options.reward,
        options.penalty,
        options.win_length,
        base_seq,
        seq,
        local,
    )


